package cn.minhx.domain.activity.service.discount.impl;

import cn.minhx.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import cn.minhx.domain.activity.service.discount.AbstractDiscountCalculator;
import com.alibaba.fastjson2.JSON;
import java.math.BigDecimal;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * N元购类型计算
 *
 * @author min
 */
@Slf4j
@Service("NY")
public class NYCalculator extends AbstractDiscountCalculator {

	@Override
	protected BigDecimal doCalculate(BigDecimal originalPrice,
			GroupBuyActivityDiscountVO.GroupBuyDiscount groupBuyDiscount) {
		log.info("优惠策略-N元购计算 originalPrice:{} groupBuyDiscount:{}", originalPrice, JSON.toJSONString(groupBuyDiscount));
		// 折扣表达式 - 优惠后金额
		String marketExpr = groupBuyDiscount.getMarketExpr();
		return new BigDecimal(marketExpr);
	}
}
